from django.db import models

# Create your models here.
class ArticleType(models.Model):
    '''
    文章的类别表
    '''
    articletype=models.CharField(max_length=30)
    def __str__(self):
        return self.articletype

class Article(models.Model):
    '''
    文章有标题，作者，摘要，内容
    '''
    title=models.CharField(max_length=100,null=False) #标题
    author_name = models.CharField(max_length=100, null=False)
    abstract = models.TextField()  # 摘要
    content=models.TextField(null=False)
    type=models.ForeignKey('ArticleType',on_delete=models.CASCADE)


class UserMsg(models.Model):
    '''
    用户有姓名，密码，邮箱，电话以及是否是管理员
    '''
    name=models.CharField(max_length=50)
    passwd=models.CharField(max_length=50)
    email=models.EmailField()
    phone=models.CharField(max_length=20)
    isadmin=models.BooleanField(default=False)


